{% extends 'bootstrap/base.html' %}
​
{% block title %}水果中心{% endblock %}

{% block navbar %}
    <nav class="navbar navbar-expand-lg navbar-inverse container" style="border-radius: 0px;">
        <div class="container col-lg-9 col-lg-offset-1">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">首页</a>
            </div>
            <div class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li><a href="http://127.0.0.1:5000/buy">购买</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="#">个人中心</a></li>
                    <li><a href="#">退出</a></li>
                </ul>
            </div>
        </div>
    </nav>
{% endblock %}
{% block scripts %}
        {{ super() }}
        <script src="../static/shopping.js"></script>
    {% endblock %}
{% block content %}
    <div class="col-lg-8 col-lg-offset-2">
        <form action="http://127.0.0.1:5000/formcheck" method="post">
            <table class="table table-hover table-bordered table-striped">
                <thead class="thead-dark">
                <tr>
                    <th scope="col">　</th>
                    <th scope="col">名称</th>
                    <th scope="col">单价（元/kg）</th>
                    <th scope="col">重量（以kg为单位）</th>
                    <th scope="col">价格（元）</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <th scope="row">1</th>
                    <td name="apple">苹果</td>
                    <td><span id="price1">{{ p[0] }}</span></td>
                    <td>
                        <input type="number" value="0.0" min="0" max="20" step="0.5" id="w1"
                               style="width: 50px;text-align: right" name="num1" onclick="check1()">
                    </td>
                    <td><span id="money1"></span></td>
                </tr>
                <tr>
                    <th scope="row">2</th>
                    <td name="pear">梨</td>
                    <td>{{ p[1] }}</td>
                    <td>
                        <input type="number" value="0.0" min="0" max="20" step="0.5" id="w2"
                               style="width: 50px;text-align: right" name="num2" onclick="check2()">
                    </td>
                    <td><span id="money2"></span></td>
                </tr>
                <tr>
                    <th scope="row">3</th>
                    <td>香蕉</td>
                    <td>{{ p[2] }}</td>
                    <td>
                        <input type="number" value="0.0" min="0" max="20" step="0.5" id="w3"
                               style="width: 50px;text-align: right" name="num3" onclick="check3()">
                    </td>
                    <td><span id="money3"></span></td>
                </tr>
                <tr>
                    <th scope="row">4</th>
                    <td>橙子</td>
                    <td>{{ p[3] }}</td>
                    <td>
                        <input type="number" value="0.0" min="0" max="20" step="0.5" id="w4"
                               style="width: 50px;text-align: right" name="num4" onclick="check4()">
                    </td>
                    <td><span id="money4"></span></td>
                </tr>
                <tr>
                    <th scope="row">5</th>
                    <td>荔枝</td>
                    <td>{{ p[4] }}</td>
                    <td>
                        <input type="number" value="0.0" min="0" max="20" step="0.5" id="w5"
                               style="width: 50px;text-align: right" name="num5" onclick="check5()">
                    </td>
                    <td><span id="money5"></span></td>
                </tr>
                <tr>
                    <th scope="row">6</th>
                    <td>柚子</td>
                    <td>{{ p[5] }}</td>
                    <td>
                        <input type="number" value="0.0" min="0" max="20" step="0.5" id="w6"
                               style="width: 50px;text-align: right" name="num6" onclick="check6()">
                    </td>
                    <td><span id="money6"></span></td>
                </tr>

                <tr>
                    <td colspan="4" style="text-align: right"><button type="button" onclick="payMoney()">合计</button></td>
                    <td><span id="addMoney"></span></td>
                </tr>
                </tbody>
            </table>
            <div style="width: 40%;margin-left: 80%">
                <button type="submit" onclick="submitForm()">提交订单</button>
            </div>
        </form>
    </div>
{% endblock %}